package game.jrogue.util;


import game.jrogue.Chest;
import game.jrogue.Describer;
import game.jrogue.Description;
import game.jrogue.Effect;
import game.jrogue.Lib;
import game.jrogue.Modifier;
import game.jrogue.Personality;
import game.jrogue.Poison;
import game.jrogue.Potion;
import game.jrogue.RPG;
import game.jrogue.Scripts;
import game.jrogue.Thing;

import java.util.LinkedHashMap;
import java.util.TreeMap;
import java.util.Iterator;

/**
 *
 * @author  Carsten Muessig <carsten.muessig@gmx.net>
 */
public class LibMetaDataHandler {
    
    private static final String THING = "사물";
    private static final String ITEM = "소지품";
    private static final String BEING = "존재";
    private static final String EFFECT = "효과";
    private static final String TEMPORARY_EFFECT = "임시 효과";
    private static final String FOOD = "음식";
    private static final String SCROLL = "두루마리";
    private static final String MISSILE = "탄환";
    private static final String RANGED_WEAPON = "장거리 무기";
    private static final String POTION = "물약";
    private static final String THROWING_WEAPON = "투척 무기";
    private static final String WAND = "마법봉";
    private static final String RING = "반지";
    private static final String COIN = "동전";
    private static final String ARMOUR = "갑옷";
    private static final String HELMET = "헬멧";
    private static final String BOOTS = "장화";
    private static final String WEAPON = "무기";
    private static final String SWORD = "검";
    private static final String HAMMER = "둔기";
    private static final String AXE = "도끼";
    private static final String POLEARM = "polearm";
    private static final String MACE = "철퇴";
    private static final String UNARMED_WEAPON = "unarmed weapon";
    private static final String SECRET = "secret";
    private static final String SECRET_DOOR = "숨겨진 문";
    private static final String SECRET_PASSAGE = "secret passage";
    private static final String SECRET_ITEM = "secret item";
    private static final String SPELLBOOK = "spellbook";
    private static final String CHEST = "chest";
    private static final String DECORATION = "decoration";
    private static final String SCENERY = "scenery";
    private static final String DOOR = "문";
    private static final String FURNITURE = "furniture";
    private static final String SIGN = "sign";
    private static final String PLANT = "plant";
    private static final String TREE = "나무";
    private static final String PORTAL = "portal";
    private static final String INVISIBLE_PORTAL = "invisible portal";
    private static final String STAIRS = "stairs";
    private static final String TRAP = "함정";
    private static final String MONSTER = "monster";
    private static final String HUMANOID = "humanoid";
    private static final String BANDIT = "산적";
    private static final String GOBLINOID = "goblinoid";
    private static final String GOBLIN = "고블린";
    private static final String ORC = "오크";
    private static final String INSECT = "곤충";
    private static final String SNAKE = "뱀";
    private static final String CRITTER = "짐승";
    private static final String PERSON = "인물";
    private static TreeMap DESCRIPTIONS = null;
    
    protected static void createLibraryItems(LinkedHashMap plugInData) {
        System.out.println("Inserting "+plugInData.size()+" items into the library");
        Iterator it = plugInData.keySet().iterator();
        while(it.hasNext()) {
            String timeStampAndMetaDataName = (String)it.next();
            TreeMap itemData = (TreeMap)plugInData.get(timeStampAndMetaDataName);
            String metaDataName = timeStampAndMetaDataName.substring(timeStampAndMetaDataName.indexOf("$")+1);
            MetaData metaData = LibMetaData.instance().get(metaDataName);
            createLibraryItem(itemData, metaData);
        }
    }
    
    private static void createLibraryItem(TreeMap itemData, MetaData metaData) {
        String itemName = (String)itemData.remove("이름");
        Thing t = new Thing();
        t.set("이름", itemName);
        boolean inserted = false;
        System.out.println(" Inserting "+itemName);
        Iterator it = itemData.keySet().iterator();
        while(it.hasNext()) {
            inserted = false;
            String property = (String)it.next();
            Object o = itemData.get(property);
            MetaDataEntry mde = metaData.get(property);
            Object value = mde.getValue();
            if(value instanceof Integer)
                o = new Integer((String)o);
            if(value instanceof Double)
                o = new Double((String)o);
            if(o instanceof TreeMap) {
                System.out.println("DEBUG: found meta data: "+property+": "+o);
                t.set(property, createLibraryItemFromMetaData(property, (TreeMap)o));
                inserted = true;
            }
            // TO DO: maybe there's a better way to create the library items
            //        (in a single method or so)
            if(o.getClass().getName().startsWith("game.jrogue")) {
                System.out.println("DEBUG: found tyrant object: "+property+": "+o+" = "+value);
                if(((String)o).indexOf("ChestCreate")>=0)
                    t.set(property, new Chest.ChestCreation());
                if(((String)o).indexOf("ChestOpen")>=0)
                    t.set(property, new Chest.ChestOpen());
                if(((String)o).indexOf("ChestClosed")>=0)
                    t.set(property, new Chest.ChestClosed());
                if(((String)o).indexOf("HealingScript")>=0)
                    t.set(property, new Potion.HealingScript());
                inserted = true;
            }
            if(!inserted)
                t.set(property, o);
        }
        Lib.add(t);
    }
    
    private static Object createLibraryItemFromMetaData(String property, TreeMap itemData) {
        // TO DO: maybe there's a better way to create the library items
        //        (in a single method or so)
    	// TO DO: update to latest Tyrant version
        Thing effect;
        if(property.equals("AddEffectScript")) {
            Integer chance = (Integer)itemData.get("Chance");
            effect = Lib.create((String)itemData.get("효과"));
            if(chance==null)
                return Scripts.addEffect((String)itemData.get("TargetProperty"), effect);
            return Scripts.addEffect((String)itemData.get("TargetProperty"), effect, chance.intValue());
        }
        else if(property.equals("TemporaryEffect")) {
            Integer multiplier = (Integer)itemData.get("Multiplier"), chance = (Integer)itemData.get("Chance");
            if(multiplier==null)
                effect = Effect.temporary(Modifier.bonus((String)itemData.get("능력치"), ((Integer)itemData.get("Bonus")).intValue()), ((Integer)itemData.get("Time")).intValue());
            else
                effect = Effect.temporary(Modifier.linear((String)itemData.get("능력치"), multiplier.intValue(), ((Integer)itemData.get("Bonus")).intValue()), ((Integer)itemData.get("Time")).intValue());
            if(chance==null)
                return Scripts.addEffect((String)itemData.get("TargetProperty"), effect);
            return Scripts.addEffect((String)itemData.get("TargetProperty"), effect, chance.intValue());
        }
        else if(property.equals("SimpleModifier")) {
            Integer multiplier = (Integer)itemData.get("Multiplier");
            if(multiplier==null)
                return Modifier.bonus((String)itemData.get("능력치"), ((Integer)itemData.get("Bonus")).intValue());
            return Modifier.linear((String)itemData.get("능력치"), multiplier.intValue(), ((Integer)itemData.get("Bonus")).intValue());
        }
        else if(property.equals("Personality")) {
            Integer state = (Integer)itemData.get("State");
            if(state==null)
                return new Personality(((Integer)itemData.get("Type")).intValue());
            return new Personality(((Integer)itemData.get("Type")).intValue(), ((Integer)itemData.get("SubType")).intValue());
        }
        return null;
    }
    
    protected static MetaData createMetaDataFromObject(Object o) {
    	// TO DO: update to latest Tyrant version
        MetaData metaData = new MetaData();        
    	String className = o.getClass().getName();
    	if(className.indexOf("ChestOpen")>=0){
    		metaData.add("TypeInfo", "ChestOpen", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
    		return metaData;
    	}
    	if(className.indexOf("ChestCreated")>=0){
    		metaData.add("TypeInfo", "ChestCreate", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
    		return metaData;
    	}
    	if(className.indexOf("ChestClosed")>=0){
    		metaData.add("TypeInfo", "ChestClosed", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
    		return metaData;
    	}
    	if(className.indexOf("HealingScript")>=0) {
    		metaData.add("TypeInfo", "HealingScript", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
    	return metaData;
    } if(className.indexOf("AddEffectScript")>=0){
    		metaData.add("TypeInfo", "AddEffectScript", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
    		metaData.add("효과", "독", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
    		metaData.add("TargetProperty", "Target", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
    		metaData.add("Chance", new Integer(100),null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
    		return metaData;
    	}
/*	TO DO: modify to current version
 
      	if(className.indexOf("효과")>=0){
    		metaData.add("TypeInfo", "TemporaryEffect", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
    		metaData.add("Time", new Integer(2000), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
    		metaData.add("Modifier", Modifier.simple("dummy",-1), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
    		metaData.add("능력치", "이동속도", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
    		metaData.add("Bonus", new Integer(2000), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
    		metaData.add("Multiplier", new Integer(100), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
    		metaData.add("TargetProperty", "Target", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
    		metaData.add("Chance", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
    		return metaData;
    	}*/
    	if(className.indexOf("Modifier")>=0) {
    		metaData.add("TypeInfo", "SimpleModifier", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
    		metaData.add("능력치", new String(), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
    		metaData.add("Bonus", new Integer(0), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
    		metaData.add("Multiplier", new Integer(0), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
    		return metaData;
    	}
    	if(className.indexOf("Personality")>=0) {
    		metaData.add("TypeInfo", "Personality", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
    		metaData.add("Type", new Integer(0), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
    		metaData.add("SubType", new Integer(0), new Integer[]{new Integer(0), new Integer(1), new Integer(2), new Integer(3), new Integer(4), new Integer(5), new Integer(6), new Integer(7), new Integer(8)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
    		metaData.add("State", new Integer(0), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
    		return metaData;
    	}
    	return null;
    }
    
    protected static LibMetaData createLibMetaData(LibMetaData lmd) {
    	// TO DO: update to latest Tyrant version, also the called methods at the bottom
        MetaData metaData = new MetaData();
        metaData.add("IsThing", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ImageSource", "Items", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(0), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("갯수", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(THING, metaData);
        
        metaData = new MetaData(lmd.get("사물"));
        metaData.add("IsItem", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ImageSource", "Items", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이름", "사물", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("NameType", new Integer(Description.NAMETYPE_NORMAL), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("Z", new Integer(Thing.Z_ITEM), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(ITEM, metaData);
        
        metaData = new MetaData(lmd.get("사물"));
        metaData.add("IsBeing",new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ImageSource", "Creatures", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(340), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsMobile",new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsBlocking", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이동비용", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("시체그래픽", "blood pool", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("NameType", new Integer(Description.NAMETYPE_NORMAL), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("Z", new Integer(Thing.Z_MOBILE), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(BEING, metaData);
        
        lmd = createEffectMetaData(lmd);
        lmd = createPoisonMetaData(lmd);
        lmd = createFoodMetaData(lmd);
        lmd = createScrollMetaData(lmd);
        lmd = createMissileMetaData(lmd);
        lmd = createRangedWeaponMetaData(lmd);
        lmd = createPotionMetaData(lmd);
        lmd = createWandMetaData(lmd);
        lmd = createRingMetaData(lmd);
        lmd = createCoinMetaData(lmd);
        lmd = createArmourMetaData(lmd);
        lmd = createWeaponMetaData(lmd);
        lmd = createSecretMetaData(lmd);
        lmd = createSpellBookMetaData(lmd);
        lmd = createChestMetaData(lmd);
        lmd = createDecorationMetaData(lmd);
        lmd = createSceneryMetaData(lmd);
        lmd = createPortalMetaData(lmd);
        lmd = createTrapMetaData(lmd);
        createMonsterMetaData(lmd);
        createPersonMetaData(lmd);
        return lmd;
    }
    
    private static LibMetaData createEffectMetaData(LibMetaData lmd) {
        MetaData metaData = new MetaData(lmd.get("사물"));
        metaData.add("IsEffect",new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ImageSource","Effects", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(45), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("효과명","효과", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(EFFECT, metaData);
        
        metaData = new MetaData(lmd.get("효과"));
        metaData.add("IsTemporaryEffect", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsActive", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(TEMPORARY_EFFECT, metaData);
        return lmd;
    }
    
    private static LibMetaData createPoisonMetaData(LibMetaData lmd) {
        MetaData metaData = new MetaData(lmd.get("효과"));
        metaData.add("IsPoison", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsActive", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("OnAction", new Poison.PoisonAction(), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("Damage", new Integer(3), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("DamageType", "독", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("DamageMessage", "You feel the poison weakening you...", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("효과명", "poisoned", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("수명", new Integer(30000), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("Strength", new Integer(200), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("특성추가메시지", "You feel poisoned!", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(POTION, metaData);
        return lmd;
    }
    
    private static LibMetaData createFoodMetaData(LibMetaData lmd) {
        MetaData metaData = new MetaData(lmd.get("소지품"));
        metaData.add("IsFood", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsEdible", new Integer(1), new Integer[] {new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(226), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(4), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("Nutrition", new Integer(10), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("아이템무게", new Integer(1000), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("빈도", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(FOOD, metaData);
        return lmd;
    }
    
    private static LibMetaData createScrollMetaData(LibMetaData lmd) {
        MetaData metaData = new MetaData(lmd.get("소지품"));
        metaData.add("IsScroll", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsReadable", new Integer(1), new Integer[] {new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsMagicItem", new Integer(1), new Integer[] {new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(280), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(2), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("아이템무게", new Integer(200), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("빈도", new Integer(40), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ScrollPower", new Integer(10), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최대레벨", new Integer(30), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이름복수", "scrolls of spell name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("식별안된이름", "scroll titled title", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("식별안된이름복수", "scrolls titled title", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ScrollSpell", "spell name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(SCROLL, metaData);
        return lmd;
    }
    
    private static LibMetaData createMissileMetaData(LibMetaData lmd) {
        MetaData metaData = new MetaData(lmd.get("소지품"));
        metaData.add("IsMissile", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(80), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("탄환회수률", new Integer(50), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("탄환종류", "bullet", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("장비종류", new Integer(RPG.WT_MISSILE), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(4), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("아이템무게", new Integer(500), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("빈도", new Integer(40), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("RSKMul", new Integer(30), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("RSKBonus",new Integer(0), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("RSTMul",new Integer(30), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("RSTBonus",new Integer(0), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(MISSILE, metaData);
        return lmd;
    }
    
    private static LibMetaData createRangedWeaponMetaData(LibMetaData lmd) {
        MetaData metaData = new MetaData(lmd.get("소지품"));
        metaData.add("IsRangedWeapon", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("RangedWeaponType", "arrow", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(120), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("장비종류", new Integer(RPG.WT_RANGEDWEAPON), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(120), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("아이템무게", new Integer(4000), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("빈도", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("RSKMul", new Integer(40), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("RSKBonus", new Integer(0), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("RSTMul", new Integer(40), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("RSTBonus", new Integer(0), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(RANGED_WEAPON, metaData);
        return lmd;
    }
    
    private static LibMetaData createPotionMetaData(LibMetaData lmd) {
        MetaData healingScript = new MetaData();
        healingScript.add("TypeInfo", "HealingScript", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        
        MetaData addEffect = new MetaData();
        addEffect.add("TypeInfo", "AddEffectScript", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        addEffect.add("효과", "독", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        addEffect.add("TargetProperty", "Target", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        addEffect.add("Chance", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
        
        MetaData temporaryEffect = new MetaData();
        temporaryEffect.add("TypeInfo", "TemporaryEffect", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        temporaryEffect.add("Time", new Integer(2000), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        temporaryEffect.add("Modifier", Modifier.bonus("dummy",-1), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        temporaryEffect.add("능력치", "이동속도", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        temporaryEffect.add("Bonus", new Integer(2000), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        temporaryEffect.add("Multiplier", new Integer(100), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
        temporaryEffect.add("TargetProperty", "Target", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        temporaryEffect.add("Chance", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
        
        MetaData metaData = new MetaData(lmd.get("소지품"));
        metaData.add("IsPotion", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsDrinkable", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsMagicItem", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(240), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(3), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("아이템무게", new Integer(500), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("빈도", new Integer(60), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("OnDrunk", new MetaData(), new MetaData[]{healingScript, addEffect, temporaryEffect}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.OPTIONAL_PROPERTY);
        metaData.add("치유위력", new Integer(8), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
        lmd.add(POTION, metaData);
        
        metaData = new MetaData(lmd.get("탄환"));
        metaData.add("IsThrowingWeapon", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("탄환종류", "thrown", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(4), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("탄환회수률", new Integer(80), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(15), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("아이템무게", new Integer(1000), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("RSKMul", new Integer(50), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("RSTMul", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("빈도", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(THROWING_WEAPON, metaData);
        return lmd;
    }
    
    private static LibMetaData createWandMetaData(LibMetaData lmd) {
        MetaData metaData = new MetaData(lmd.get("소지품"));
        metaData.add("IsWand", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsMagicItem", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(288), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(10), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("아이템무게", new Integer(800), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("빈도", new Integer(60), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("Charges", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(288), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("식별안된이름","wand name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이름","wand of wand name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이름복수","wands of wand name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("WandSpell", "spell name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(WAND, metaData);
        return lmd;
    }
    
    private static LibMetaData createRingMetaData(LibMetaData lmd) {
        MetaData modifier = new MetaData();
        modifier.add("TypeInfo", "SimpleModifier", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        modifier.add("능력치", new String(), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        modifier.add("Bonus", new Integer(0), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        modifier.add("Multiplier", new Integer(0), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
        
        MetaData metaData = new MetaData(lmd.get("소지품"));
        metaData.add("IsRing", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("장비종류", new Integer(RPG.WT_LEFTRING), new Integer[]{new Integer(RPG.WT_LEFTRING), new Integer(RPG.WT_RIGHTRING)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsMagicItem", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(200), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(36), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("아이템무게", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("빈도", new Integer(30), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("장비수정치", modifier, null, MetaDataEntry.FIX_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
        lmd.add(RING, metaData);
        return lmd;
    }
    
    private static LibMetaData createCoinMetaData(LibMetaData lmd) {
        MetaData metaData = new MetaData(lmd.get("소지품"));
        metaData.add("IsMoney", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(140), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(6), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("아이템무게", new Integer(20), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("가격", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("Z", new Integer(Thing.Z_ITEM-2), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("빈도", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(COIN, metaData);
        return lmd;
    }
    
    private static LibMetaData createArmourMetaData(LibMetaData lmd) {
        MetaData metaData = new MetaData(lmd.get("소지품"));
        metaData.add("IsArmour", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(340), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("장비종류", new Integer(RPG.WT_TORSO), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(70), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("아이템무게", new Integer(20000), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("빈도", new Integer(50), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(ARMOUR, metaData);
        
        metaData = new MetaData(lmd.get("갑옷"));
        metaData.add("IsHelmet", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(323), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("장비종류", new Integer(RPG.WT_HEAD), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(40), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("아이템무게", new Integer(5000), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(HELMET, metaData);
        
        MetaData modifier = new MetaData();
        modifier.add("TypeInfo", "SimpleModifier", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        modifier.add("능력치", new String(), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        modifier.add("Bonus", new Integer(0), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        modifier.add("Multiplier", new Integer(0), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
        
        metaData = new MetaData(lmd.get("갑옷"));
        metaData.add("IsFootwear", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(360), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("NameType", new Integer(Describer.NAMETYPE_QUANTITY), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("장비종류", new Integer(RPG.WT_BOOTS), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(24), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(5), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("아이템무게", new Integer(2800), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("식별안된이름","장화", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsMagicItem", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
        metaData.add("장비수정치", modifier, null, MetaDataEntry.FIX_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
        lmd.add(BOOTS, metaData);
        return lmd;
    }
    
    private static LibMetaData createWeaponMetaData(LibMetaData lmd) {
        MetaData metaData = new MetaData(lmd.get("소지품"));
        metaData.add("IsWeapon", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(2), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("장비종류", new Integer(RPG.WT_MAINHAND), new Integer[]{new Integer(RPG.WT_MAINHAND), new Integer(RPG.WT_TWOHANDS)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(40), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("아이템무게", new Integer(6000), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("빈도", new Integer(50), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("공격비용", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ASKMul", new Integer(80), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ASKBonus", new Integer(0), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ASTMul", new Integer(80), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ASTBonus", new Integer(0), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("DSKMul", new Integer(40), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("DSKBonus", new Integer(0), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(WEAPON, metaData);
        
        metaData = new MetaData(lmd.get("무기"));
        metaData.add("IsSword", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이름", "material + name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("재질", "material", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("식별안된이름", "uname + name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(SWORD, metaData);
        
        metaData = new MetaData(lmd.get("무기"));
        metaData.add("IsHammer", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이름", "material + name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("재질", "material", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("식별안된이름", "uname + name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(HAMMER, metaData);
        
        metaData = new MetaData(lmd.get("무기"));
        metaData.add("IsAxe", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이름", "material + name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("재질", "material", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("식별안된이름", "uname + name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(AXE, metaData);
        
        metaData = new MetaData(lmd.get("무기"));
        metaData.add("IsPolearm", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이름", "material + name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("재질", "material", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("식별안된이름", "uname + name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(POLEARM, metaData);
        
        metaData = new MetaData(lmd.get("무기"));
        metaData.add("IsMace", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이름", "material + name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("재질", "material", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("식별안된이름", "uname + name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(MACE, metaData);
        
        MetaData addEffectScript = new MetaData();
        addEffectScript.add("TypeInfo", "AddEffectScript", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        addEffectScript.add("TargetProperty", new String(), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        addEffectScript.add("TargetName", new String(), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        addEffectScript.add("Chance", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
        
        metaData = new MetaData(lmd.get("무기"));
        metaData.add("IsUnarmedWeapon", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("OnWeaponDamage", addEffectScript, null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(UNARMED_WEAPON, metaData);
        return lmd;
    }
    
    private static LibMetaData createSecretMetaData(LibMetaData lmd) {
        MetaData metaData = new MetaData(lmd.get("사물"));
        metaData.add("IsSecret", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsInvisible", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ImageSource","Effects", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(5), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(SECRET, metaData);
        
        metaData = new MetaData(lmd.get("secret"));
        metaData.add("IsSecretDoor", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(SECRET_DOOR, metaData);
        
        metaData = new MetaData(lmd.get("secret"));
        metaData.add("IsSecretPassage", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(SECRET_PASSAGE, metaData);
        
        metaData = new MetaData(lmd.get("secret"));
        metaData.add("IsHiddenItem", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HiddenThing", "thing name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(SECRET_ITEM, metaData);
        return lmd;
    }
    
    private static LibMetaData createSpellBookMetaData(LibMetaData lmd) {
        MetaData metaData = new MetaData(lmd.get("소지품"));
        metaData.add("IsSpellBook", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsReadable", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsMagicItem", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(285), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(12), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("아이템무게", new Integer(3000), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("빈도", new Integer(50), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨",new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최대레벨",new Integer(30), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이름","spellbook of spell name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이름복수","spellbooks of spell names", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("식별안된이름", "title", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("BookSpell", "spell name", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(SPELLBOOK, metaData);
        return lmd;
    }
    
    private static LibMetaData createChestMetaData(LibMetaData lmd) {
        MetaData chestCreate = new MetaData();
        chestCreate.add("TypeInfo", "ChestCreate", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        
        MetaData chestOpen = new MetaData();
        chestOpen.add("TypeInfo", "ChestOpen", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        
        MetaData chestClosed = new MetaData();
        chestClosed.add("TypeInfo", "ChestClosed", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
        
        MetaData metaData = new MetaData(lmd.get("소지품"));
        metaData.add("IsChest", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsOpenable", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ImageSource","Scenery", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(121), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("아이템무게", new Integer(10000), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("Z", new Integer(Thing.Z_ITEM-2), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ImageOpen", new Integer(2), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        //metaData.add("OnCreate", new Chest.ChestCreation(), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        //metaData.add("OnOpen", new Chest.ChestOpen(), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
        //metaData.add("OnClosed", new Chest.ChestClosed(), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
        lmd.add(CHEST, metaData);
        return lmd;
    }
    
    private static LibMetaData createDecorationMetaData(LibMetaData lmd) {
        MetaData metaData = new MetaData(lmd.get("사물"));
        metaData.add("IsDecoration", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ImageSource", "Scenery", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsTransparent", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("Z", new Integer(Thing.Z_ONFLOOR), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(DECORATION, metaData);
        return lmd;
    }
    
    private static LibMetaData createSceneryMetaData(LibMetaData lmd) {
        MetaData metaData = new MetaData(lmd.get("사물"));
        metaData.add("IsScenery", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ImageSource","Scenery", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsBlocking", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsOwned", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("Z", new Integer(Thing.Z_ITEM-1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(10), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(SCENERY, metaData);
        
        metaData = new MetaData(lmd.get("scenery"));
        metaData.add("IsDoor", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsOpenable", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(144), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ImageOpen", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("Z", new Integer(Thing.Z_ITEM+1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsOpen", new Integer(0), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsViewBlocking", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsBlocking", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(30), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(DOOR, metaData);
        
        metaData = new MetaData(lmd.get("scenery"));
        metaData.add("IsFurniture", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(200), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(7), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(FURNITURE, metaData);
        
        metaData = new MetaData(lmd.get("scenery"));
        metaData.add("IsSign", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(64), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(20), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsBlocking", new Integer(0), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(SIGN, metaData);
        
        metaData = new MetaData(lmd.get("scenery"));
        metaData.add("IsPlant", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(81), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsViewBlocking", new Integer(0), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsBlocking", new Integer(0), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(4), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(PLANT, metaData);
        
        metaData = new MetaData(lmd.get("scenery"));
        metaData.add("IsTree", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(83), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("HPS", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsViewBlocking", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsBlocking", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(TREE, metaData);
        //to do: do we need meta data for fire?
        return lmd;
    }
    
    private static LibMetaData createPortalMetaData(LibMetaData lmd) {
        MetaData metaData = new MetaData(lmd.get("scenery"));
        metaData.add("IsPortal", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsBlocking", new Integer(0), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ImageSource", "Scenery", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(1), null, MetaDataEntry.OPTIONAL_PROPERTY, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(PORTAL, metaData);
        
        metaData = new MetaData(lmd.get("portal"));
        metaData.add("IsInvisible", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(INVISIBLE_PORTAL, metaData);
        
        metaData = new MetaData(lmd.get("portal"));
        metaData.add("IsStairs", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsBlocking", new Integer(0), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsInvisible", new Integer(0), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(STAIRS, metaData);
        return lmd;
    }
    
    private static LibMetaData createTrapMetaData(LibMetaData lmd) {
        MetaData metaData = new MetaData(lmd.get("secret"));
        metaData.add("IsTrap", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(47), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsWarning", new Integer(1), new Integer[] {new Integer(0), new Integer(1)}, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsActivated", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("Z", new Integer(Thing.Z_FLOOR), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(TRAP, metaData);
        return lmd;
    }
    
    private static LibMetaData createMonsterMetaData(LibMetaData lmd) {
        MetaData metaData = new MetaData(lmd.get("존재"));
        metaData.add("IsMonster", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsMobile", new Integer(1), new Integer[] {new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsHostile", new Integer(1), new Integer[] {new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최대레벨", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ImageSource", "Creatures", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(340), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsActive", new Integer(1), new Integer[] {new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이동속도", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("공격속도", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("SK", new Integer(9), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("ST", new Integer(8), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("AG", new Integer(9), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("TG", new Integer(8), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IN", new Integer(7), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("WP", new Integer(8), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("CH", new Integer(6), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("CR", new Integer(7), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(MONSTER, metaData);
        
        metaData = new MetaData(lmd.get("monster"));
        metaData.add("IsHumanoid", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsIntelligent", new Integer(1), new Integer[] {new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(5), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최대레벨", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(260), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(HUMANOID, metaData);
        
        metaData = new MetaData(lmd.get("humanoid"));
        metaData.add("IsBandit", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(7), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최대레벨", new Integer(14), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(80), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(BANDIT, metaData);
        
        metaData = new MetaData(lmd.get("humanoid"));
        metaData.add("IsGoblinoid", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(240), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(GOBLINOID, metaData);
        
        metaData = new MetaData(lmd.get("goblinoid"));
        metaData.add("IsGoblin", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("시체그래픽", "slime pool", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(6), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최대레벨", new Integer(15), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(244), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(GOBLIN, metaData);
        
        metaData = new MetaData(lmd.get("고블린"));
        metaData.add("IsOrc", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(8), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최대레벨", new Integer(17), null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(242), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(ORC, metaData);
        
        metaData = new MetaData(lmd.get("monster"));
        metaData.add("IsInsect", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("시체그래픽", "slime pool", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("빈도", new Integer(40), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(3), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최대레벨", new Integer(15), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(INSECT, metaData);
        
        metaData = new MetaData(lmd.get("monster"));
        metaData.add("IsSnake", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("빈도", new Integer(25), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이동속도", new Integer(70), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("이미지", new Integer(286), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(2), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최대레벨", new Integer(8), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        //      to do: store meta data of unarmed weapon
        //      metaData.add("UnarmedWeapon", new Script(), null, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.OPTIONAL_PROPERTY);
        lmd.add(SNAKE, metaData);
        
        metaData = new MetaData(lmd.get("monster"));
        metaData.add("IsCritter", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("빈도", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최소레벨", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("최대레벨", new Integer(20), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(CRITTER, metaData);
        return lmd;
    }
    
    private static LibMetaData createPersonMetaData(LibMetaData lmd) {
        MetaData personality = new MetaData();
        personality.add("TypeInfo", "Personality", null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        personality.add("Type", new Integer(0), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        personality.add("SubType", new Integer(0), new Integer[]{new Integer(0), new Integer(1), new Integer(2), new Integer(3), new Integer(4), new Integer(5), new Integer(6), new Integer(7), new Integer(8)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        personality.add("State", new Integer(0), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.OPTIONAL_PROPERTY);
        
        MetaData metaData = new MetaData(lmd.get("monster"));
        metaData.add("IsPerson", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsHostile", new Integer(0), new Integer[] {new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("IsIntelligent", new Integer(1), new Integer[] {new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);
        metaData.add("Personality", personality, null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);
        lmd.add(PERSON, metaData);
        return lmd;
    }
    
    protected static TreeMap createPropertyDescriptions() {
    	if(DESCRIPTIONS==null) {
        TreeMap descriptions = new TreeMap();
        descriptions.put("SK", "기술");
        descriptions.put("ST", "완력");
        descriptions.put("AG", "민첩");
        descriptions.put("TG", "체력");
        descriptions.put("IN", "지능");
        descriptions.put("WP", "의지");
        descriptions.put("CH", "매력");
        descriptions.put("CR", "손재주");
        descriptions.put("HPS", "생명력");
        descriptions.put("HPSMAX", "최대 생명력");
        descriptions.put("MPS", "마법력");
        descriptions.put("MPSMAX", "최대 마법력");
        descriptions.put("APS", "행동 점수 (일반 속도에서 1턴당 100)");
        descriptions.put("IsDecoration", "장식용");
        descriptions.put("NoStack", "한 칸에 여러개가 겹쳐지지 않도록 함");
        descriptions.put("IsBlocking", "놓인 칸에 자유롭게 이동할 수 없도록 함");
        descriptions.put("IsViewBlocking", "시야를 막음");
        descriptions.put("IsInvisible", "투명한지 여부");
        descriptions.put("레벨", "객체의 레벨");
        descriptions.put("빈도", "이 사물이 얼마나 흔한지 여부");
        descriptions.put("최소레벨", "생성에 요구되는 최소 레벨 (반드시 요구됨!)");
        descriptions.put("최대레벨", "생성에 요구되는 최대 레벨");
        descriptions.put("IsActive", "게임 업데이트를 받음");
        descriptions.put("IsMobile", "Moves around, has DirectionX and DirectionY set on motion, can fight");
        descriptions.put("DirectionX", "Horizontal direction of last move");
        descriptions.put("DirectionY", "Vertical direction of last move");
        descriptions.put("IsDoor", "");
        descriptions.put("IsSecretDoor", "");
        descriptions.put("IsOpen", "");
        descriptions.put("IsOpenable", "Can be opened e.g. door, chest");
        descriptions.put("IsLocked", "");
        descriptions.put("LockDifficulty", "");
        descriptions.put("IsPortal", "");
        descriptions.put("PortalTargetMap", "Opposite portal object");
        descriptions.put("PortalTargetX", "");
        descriptions.put("PortalTargetY", "");
        descriptions.put("DestinationLevel", "Specific level for target dungeon");
        descriptions.put("DestinationLevelIncrement", "Level increment over current portal level");
        descriptions.put("WorldMap",  "Hero only � top level world map");
        descriptions.put("IsPenetrable", "Is possible to move through (with some resistance), requires IsBlocking");
        descriptions.put("IsPushable", "");
        descriptions.put("IsWarning", "Warning for monsters");
        descriptions.put("IsUsable", "");
        descriptions.put("IsSecret", "Responds to 'search'");
        descriptions.put("IsSecretPassage", "");
        descriptions.put("IsHiddenItem", "");
        descriptions.put("HiddenThing", "Actual hidden thing");
        descriptions.put("HiddenItem", "Name of hidden item to create (null is random)");
        descriptions.put("IsItem", "Indicates whether the object is a pick-uppable item");
        descriptions.put("IsArtifact", "");
        descriptions.put("IsRusty", "");
        descriptions.put("IsIdentified", "");
        descriptions.put("Damage", "");
        descriptions.put("아이템무게", "Weight per unit");
        descriptions.put("갯수", "");
        descriptions.put("가격", "Value per unit");
        descriptions.put("이미지", "Number of image in bitmap image (20 per row)");
        descriptions.put("ImageSource", "Name of bitmap image");
        descriptions.put("IsWieldable", "");
        descriptions.put("장비종류", "");
        descriptions.put("IsDrinkable", "");
        descriptions.put("IsReadable", "");
        descriptions.put("IsRangedWeapon", "");
        descriptions.put("IsMagicItem", "");
        descriptions.put("IsFootwear", "");
        descriptions.put("ARM", "Basic armour");
        descriptions.put("ARM:[damtype]", "Armour value vs. particular damage type");
        descriptions.put("RES:[damtype]", "Damage resistance");
        descriptions.put("IsArt", "");
        descriptions.put("IsSpell", "");
        descriptions.put("레벨", "Achieved skill level");
        descriptions.put("SpellCost", "Cost in Mps");
        descriptions.put("SpellTarget", "Int type � self, target, item etc.");
        descriptions.put("SpellUsage", "Int type � offensive, defensive etc.");
        descriptions.put("SpellCastTime", "");
        descriptions.put("SpellRadius", "");
        descriptions.put("BoltImage", "");
        descriptions.put("IsSkill", "");
        descriptions.put("SkillCost", "Cost to increase skill by one level");
        descriptions.put("IsScroll", "");
        descriptions.put("ScrollSpell", "Spell name");
        descriptions.put("ScrollPower",  "Scroll cast power (IN)");
        descriptions.put("IsFood", "");
        descriptions.put("IsEdible", "");
        descriptions.put("허기", "Hunger level (in ticks), increases over time");
        descriptions.put("허기한계", "");
        descriptions.put("Nutrition", "Food value provided if eaten");
        descriptions.put("IsInsect", "");
        descriptions.put("IsGoblinoid", "");
        descriptions.put("IsGoblin", "");
        descriptions.put("IsOrc", "");
        descriptions.put("IsSpider", "");
        descriptions.put("IsSnake", "");
        descriptions.put("IsGenerator", "Marks a generator, also needs IsActive set");
        descriptions.put("GenerationRate", "Rate (per million ticks = per 10,000 turns)");
        descriptions.put("GenerationType",  "Type of creature to generate");
        descriptions.put("부패율", "Rate (per million ticks = per 10,000 turns)");
        descriptions.put("부패종류", "Type of object to generate on decay");
        descriptions.put("부패메시지", "");
        descriptions.put("AreaDamage", "Damage per turn (100 ticks)");
        descriptions.put("AreaDamageType", "");
        descriptions.put("AreaDamageMessage", "Message to hero");
        descriptions.put("수명", "Lifetime in ticks");
        descriptions.put("AIMode", "Guard, Wander, Attack, Follow");
        descriptions.put("IsHostile", "Is hostile to player");
        descriptions.put("IsInhabitant", "Is a local inhabitant (NPC)");
        descriptions.put("IsInsane", "Attacks anything and everything");
        descriptions.put("GroupNumber", "Typical group size = d(gn)");
        descriptions.put("Leader", "Reference to leader");
        descriptions.put("GuardX1", "");
        descriptions.put("GuardY1", "");
        descriptions.put("GuardX2", "");
        descriptions.put("GuardY2", "");
        descriptions.put("IsEffect","");
        descriptions.put("IsPoison", "");
        descriptions.put("Damage", "Average damage in HPS");
        descriptions.put("Strength", "Number of hits per million ticks = per 10,000 turns");
        descriptions.put("DamageType", "Damage type e.g. 'poison'");
        descriptions.put("DamageMessage", "Message to display when damage occurs");
        descriptions.put("IsRangedWeapon", "");
        descriptions.put("IsMissile", "");
        descriptions.put("IsThrowingWeapon", "");
        descriptions.put("탄환종류", "Name of bolt type e.g. 'arrow'");
        descriptions.put("RangedWeaponType", "Needs to match MissileType of appropriate missiles");
        descriptions.put("FireCost", "APS cost to fire");
        descriptions.put("RSKMul", "");
        descriptions.put("RSKBonus", "");
        descriptions.put("RSTMul", "");
        descriptions.put("RSTBonus", "");
        descriptions.put("ThrowRange", "");
        descriptions.put("거리", "");
        descriptions.put("탄환회수률", "발사된 탄환이 남아있을 확률");
        descriptions.put("이름", "");
        descriptions.put("설명", "보여줄 설명 메시지");
        descriptions.put("IsHostile", "지역 주민들이 적대적인가?");
        descriptions.put("Target", "이벤트의 목표");
        descriptions.put("Time", "이벤트가 발생하는 기간");
        descriptions.put("OnCreate", "Called when object created");
        descriptions.put("OnAction", "Called when time progresses on map");
        descriptions.put("OnWeaponAttack", "Called when a weapon attacks a target");
        descriptions.put("OnWeaponHit", "Called when a weapon hits a target");
        descriptions.put("OnDeath", "Called when a thing is killed");
        descriptions.put("능력치", "수정이 적용될 능력치");
        descriptions.put("근원", "수정치가 적용되는 근원이 되는 사물");
        descriptions.put("우선도", "능력치 수정 반영의 순서, 높은 숫자가 먼저 반영되어 최종치가 계산됨");
        descriptions.put("IsFurniture", "");
        descriptions.put("IsSign", "");
        descriptions.put("IsTree", "");
        descriptions.put("IsPlant", "");
        descriptions.put("IsCritter", "");
        descriptions.put("IsBandit", "");
        descriptions.put("IsPerson", "");
        descriptions.put("IsUnarmedWeapon", "");
        descriptions.put("IsStairs", "");
        descriptions.put("IsScenery", "");
        descriptions.put("IsBeing", "");
        descriptions.put("IsThing", "");
        descriptions.put("IsTemporaryEffect", "");
        descriptions.put("IsFire", "");
        descriptions.put("Z", "Z축(위/아래) 정럴순서");
        DESCRIPTIONS = descriptions;
    	}
        return DESCRIPTIONS;
    }
}